<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<ui:composition>

	<h:panelGrid columns="1" id="orderInputPanel"
		style="width:100%;border:0px"
		rendered="#{orderModel.isShowDetailPanel}">
		<p:tabView>
			<p:tab title="Detail info">
				<ui:include src="orderDetailInputPanel.xhtml"></ui:include>
			</p:tab>
			<p:tab title="Basic info">
				<ui:include src="orderInfoInputPanel.xhtml"></ui:include>
			</p:tab>
		</p:tabView>
		<h:panelGrid columns="2">
			<p:splitButton icon="add" value="New" ajax="true"
				update=":listForm,:detailForm,:headerForm">
				<f:setPropertyActionListener value="#{orderModel.newObject}"
					target="#{orderController.modelCurrent}" />
				<p:menuitem value="Cancel" ajax="true"
					update=":listForm,:detailForm,:headerForm"
					actionListener="#{orderController.cancelCurrent}"
					disabled="#{!orderModel.current.canCancel}" />
				<p:menuitem value="Pay" ajax="true" oncomplete="payDlg.show()"
					actionListener="#{orderController.prePayCurrent}"
					update=":dialogForm" disabled="#{!orderModel.current.canPay}" />
				<p:menuitem value="Pickup" ajax="true"
					update=":listForm,:detailForm,:headerForm"
					actionListener="#{orderController.pickupCurrent}"
					disabled="#{!orderModel.current.canPickup}" />
				<p:menuitem value="Deliver" ajax="true"
					update=":listForm,:detailForm,:headerForm"
					actionListener="#{orderController.deliverCurrent}"
					disabled="#{!orderModel.current.canDeliver}" />
				<p:menuitem value="Prepare" ajax="true"
					update=":listForm,:detailForm,:headerForm"
					actionListener="#{orderController.prepareCurrent}"
					disabled="#{!orderModel.current.canPrepare}" />
				<p:menuitem value="Confirm" ajax="true"
					update=":listForm,:detailForm,:headerForm"
					actionListener="#{orderController.confirmCurrent}"
					disabled="#{!orderModel.current.canConfirm}" />
				<p:menuitem value="Save" ajax="true" icon="save"
					update=":listForm,:detailForm,:headerForm"
					actionListener="#{orderController.saveCurrent}" />
			</p:splitButton>

			<p:splitButton value="Refresh" ajax="true"
				update=":listForm,:detailForm"
				actionListener="#{orderController.refreshCurrent}">
				<p:menuitem value="Restore" ajax="true"
					update=":listForm,:detailForm,:headerForm"
					actionListener="#{orderController.restoreCurrent}"
					disabled="#{!orderModel.current.canRestore}" />
				<p:menuitem value="Unpay" ajax="true"
					update=":listForm,:detailForm,:headerForm"
					actionListener="#{orderController.unPayCurrent}"
					disabled="#{!orderModel.current.canUnpay}" />
				<p:menuitem value="Unpickup" ajax="true"
					update=":listForm,:detailForm,:headerForm"
					actionListener="#{orderController.unPickupCurrent}"
					disabled="#{!orderModel.current.canUnpickup}" />
				<p:menuitem value="Undeliver" ajax="true"
					update=":listForm,:detailForm,:headerForm"
					actionListener="#{orderController.unDeliverCurrent}"
					disabled="#{!orderModel.current.canPickup}" />
				<p:menuitem value="Unprepare" ajax="true"
					update=":listForm,:detailForm,:headerForm"
					actionListener="#{orderController.unPrepareCurrent}"
					disabled="#{!orderModel.current.canDeliver}" />
				<p:menuitem value="Unconfirm" ajax="true"
					update=":listForm,:detailForm,:headerForm"
					actionListener="#{orderController.unConfirmCurrent}"
					disabled="#{!orderModel.current.canPrepare}" />
				<p:menuitem value="delete" icon="delete" ajax="true" update=":dialogForm"
				 oncomplete="deleteDlg.show()" />
			</p:splitButton>
		</h:panelGrid>
	</h:panelGrid>

</ui:composition>
</html>